package net.wanho.controller;

import net.wanho.entity.User;
import net.wanho.vo.AjaxResult;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

/**
 * Author：汤小洋
 * Date：2024-04-02 10:32
 * Description：<描述>
 */
@RestController
@RequestMapping("/users")
public class UserController {

    @Value("${server.port}")
    int port;

    @GetMapping("/test")
    public String test(){
        return "provider: " + port;
    }

    @GetMapping
    public AjaxResult list(String username){
        return AjaxResult.success(new User(1, username, "123456"));
    }

    @PostMapping
    public AjaxResult add(@RequestBody User user){
        return AjaxResult.success(user);
    }

}
